x86: fix early option scanning
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 20 Jun 2007 13:57:49 +0000 (14:57 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 20 Jun 2007 13:57:49 +0000 (14:57 +0100)
Make sure command lines like
... vgaxyz vga=
... console=vga vga=
do not mistakenly ignore the vga= option due to finding 'vga' earlier
on the line.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/boot/cmdline.S

index 9dcce5e155ec43e25c1c26109232f8aac9c290c1..3e7476d550894596e5d8148791e4db82c2e090f1 100644 (file)
         ret
 
 .Lfind_option:
+        mov     4(%esp),%eax
+        dec     %eax
         push    %ebx
-        push    4+8(%esp)
-        push    4+8(%esp)
+1:      pushl   4+8(%esp)
+        inc     %eax
+        push    %eax
         call    .Lstrstr
         add     $8,%esp
         test    %eax,%eax
         jz      3f
         cmp     %eax,4+4(%esp)
-        je      1f
+        je      2f
         cmpb    $' ',-1(%eax)
-        jne     2f
-1:      mov     %eax,%ebx
-        push    4+8(%esp)
+        jne     1b
+2:      mov     %eax,%ebx
+        pushl   4+8(%esp)
         call    .Lstrlen
         add     $4,%esp
-        xchg    %eax,%ebx
-        add     %eax,%ebx
+        xadd    %eax,%ebx
         cmpb    $'\0',(%ebx)
         je      3f
         cmpb    $' ',(%ebx)
         je      3f
         cmpb    $'=',(%ebx)
-        je      3f
-2:      xor     %eax,%eax
+        jne     1b
 3:      pop     %ebx
         ret